home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / utility1 / gs261src.zip / GDEBUG.H < prev    next >
C/C++ Source or Header  |  1993-05-13  |  3KB  |  85 lines

  1. /* Copyright (C) 1989, 1992 Aladdin Enterprises.  All rights reserved.
  2.  
  3. This file is part of Ghostscript.
  4.  
  5. Ghostscript is distributed in the hope that it will be useful, but
  6. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  7. to anyone for the consequences of using it or for whether it serves any
  8. particular purpose or works at all, unless he says so in writing.  Refer
  9. to the Ghostscript General Public License for full details.
  10.  
  11. Everyone is granted permission to copy, modify and redistribute
  12. Ghostscript, but only under the conditions described in the Ghostscript
  13. General Public License.  A copy of this license is supposed to have been
  14. given to you along with Ghostscript so you can know your rights and
  15. responsibilities.  It should be in a file named COPYING.  Among other
  16. things, the copyright notice and this notice must be preserved on all
  17. copies.  */
  18.  
  19. /* gdebug.h */
  20. /* Debugging machinery for Ghostscript */
  21.  
  22. /* Debugging options array */
  23. extern char gs_debug[128];
  24. /* If debugging, direct all error output to gs_debug_out. */
  25. #ifdef DEBUG
  26. extern FILE *gs_debug_out;
  27. #undef dstderr
  28. #define dstderr gs_debug_out
  29. #undef estderr
  30. #define estderr gs_debug_out
  31. #endif
  32.  
  33. /* Insert code conditionally if debugging. */
  34. #ifdef DEBUG
  35. #  define do_debug(x) x
  36. #else
  37. #  define do_debug(x)
  38. #endif
  39.  
  40. /* Debugging printout macros. */
  41. #ifdef DEBUG
  42. #  define debug_c(c)\
  43.     (c>='a' && c<='z' ? gs_debug[c] | gs_debug[c^32] : gs_debug[c])
  44. #  define if_debug0(c,s)\
  45.     if (debug_c(c)) dprintf(s)
  46. #  define if_debug1(c,s,a1)\
  47.     if (debug_c(c)) dprintf1(s,a1)
  48. #  define if_debug2(c,s,a1,a2)\
  49.     if (debug_c(c)) dprintf2(s,a1,a2)
  50. #  define if_debug3(c,s,a1,a2,a3)\
  51.     if (debug_c(c)) dprintf3(s,a1,a2,a3)
  52. #  define if_debug4(c,s,a1,a2,a3,a4)\
  53.     if (debug_c(c)) dprintf4(s,a1,a2,a3,a4)
  54. #  define if_debug5(c,s,a1,a2,a3,a4,a5)\
  55.     if (debug_c(c)) dprintf5(s,a1,a2,a3,a4,a5)
  56. #  define if_debug6(c,s,a1,a2,a3,a4,a5,a6)\
  57.     if (debug_c(c)) dprintf6(s,a1,a2,a3,a4,a5,a6)
  58. #  define if_debug7(c,s,a1,a2,a3,a4,a5,a6,a7)\
  59.     if (debug_c(c)) dprintf7(s,a1,a2,a3,a4,a5,a6,a7)
  60. #  define if_debug8(c,s,a1,a2,a3,a4,a5,a6,a7,a8)\
  61.     if (debug_c(c)) dprintf8(s,a1,a2,a3,a4,a5,a6,a7,a8)
  62. #  define if_debug9(c,s,a1,a2,a3,a4,a5,a6,a7,a8,a9)\
  63.     if (debug_c(c)) dprintf9(s,a1,a2,a3,a4,a5,a6,a7,a8,a9)
  64. #  define if_debug10(c,s,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)\
  65.     if (debug_c(c)) dprintf10(s,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
  66. #  define if_debug11(c,s,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)\
  67.     if (debug_c(c)) dprintf11(s,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)
  68. #  define if_debug12(c,s,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12)\
  69.     if (debug_c(c)) dprintf12(s,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12)
  70. #else
  71. #  define if_debug0(c,s) 0
  72. #  define if_debug1(c,s,a1) 0
  73. #  define if_debug2(c,s,a1,a2) 0
  74. #  define if_debug3(c,s,a1,a2,a3) 0
  75. #  define if_debug4(c,s,a1,a2,a3,a4) 0
  76. #  define if_debug5(c,s,a1,a2,a3,a4,a5) 0
  77. #  define if_debug6(c,s,a1,a2,a3,a4,a5,a6) 0
  78. #  define if_debug7(c,s,a1,a2,a3,a4,a5,a6,a7) 0
  79. #  define if_debug8(c,s,a1,a2,a3,a4,a5,a6,a7,a8) 0
  80. #  define if_debug9(c,s,a1,a2,a3,a4,a5,a6,a7,a8,a9) 0
  81. #  define if_debug10(c,s,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) 0
  82. #  define if_debug11(c,s,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11) 0
  83. #  define if_debug12(c,s,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12) 0
  84. #endif
  85.